package com.hxx.common.core.wcontour.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 气象温度颜色对应枚举
 *
 * @author hxd
 */
public enum TempColorEnum {
        
    T_5(5, "#81a8ff"),
    T_10(10, "#81a8ff"),
    T_15(15, "#81fbff"),
    T_17(17, "#81ffbc"),
    T_19(19, "#99ff81"),
    TC_21(21, "#d1ff81"),
    TC_23(23, "#fffa7a"),
    TC_25(25, "#fff000"),
    TC_30(30, "#ffde00"),
    TC_35(35, "#ffa318"),
    TC_37(37, "#ff6600"),
    TC_39(39, "#ff0000")
    ;

    TempColorEnum(double value, String color) {
        this.value = value;
        this.color = color;
    }

    /**
     * 开氏度=摄氏度+273.15
     */
    private double value;

    /**
     * 温度对应颜色
     */
    private String color;

    public double getValue() {
        return value;
    }

    public String getColor() {
        return color;
    }

    /**
     * 摄氏度数组
     *
     * @return
     */
    public static double[] getValueArray() {
        int length = TempColorEnum.values().length;
        double[] tempArray = new double[length];
        int i = 0;
        for (TempColorEnum anEnum : TempColorEnum.values()) {
            tempArray[i++] = anEnum.value;
        }
        return tempArray;
    }

    /**
     * 温度对应颜色Map
     *
     * @return
     */
    public static Map<Double, String> getValueColorMap() {
        Map<Double, String> map = new LinkedHashMap<>();
        for (TempColorEnum anEnum : TempColorEnum.values()) {
            map.put(anEnum.value, anEnum.getColor());
        }
        return map;
    }
}
